package cart.service;


import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class RabbitService {

    @Autowired
    StringRedisTemplate redisTemplate;

    /**
     * 删除redis中购物的数据
     *
     * @param cartKey
     */
    @RabbitListener(queues = "cartKey")
    public void deleteCart(String cartKey) {
        redisTemplate.delete(cartKey);
    }
}
